#!/usr/bin/env python
# -*- coding: utf8 -*-
# title       :
# description :
# author      :'ShenMeng'

import json
import os
def get_desktop_path():
    user_folder = os.path.expanduser('~')
    ver_desktop_path = os.path.join(user_folder, 'versatile', 'desktop')
    if not os.path.isdir(ver_desktop_path):
        os.makedirs(ver_desktop_path)
    return ver_desktop_path

def get_skin_data_path():
    return os.path.join(get_desktop_path(), 'skin.data')


def get_project_data_path():
    return os.path.join(get_desktop_path(), 'project.data')


def dump_skin_data(data):
    skin_data_path = get_skin_data_path()
    with open(skin_data_path, 'w') as skin_file:
        skin_file.write(json.dumps(data))

def load_skin_data():
    skin_data_path = get_skin_data_path()
    with open(skin_data_path) as skin_file:
        data = json.load(skin_file)
    return data

def dump_project_data(data):
    project_data_path = get_project_data_path()
    with open(project_data_path, 'w') as project_file:
        project_file.write(json.dumps(data))

def load_project_data():
    project_data_path = get_project_data_path()
    with open(project_data_path) as project_file:
        data = json.load(project_file)
    return data

if __name__ == '__main__':
    # project_info = ['kunTa2', 'modeling']
    # refresh_skin_info(project_info)
    load_skin_data()